package com.ttl.web.controller;

import com.ttl.web.entity.Suggestion;
import com.ttl.web.service.SuggestionService;
import com.ttl.web.utils.ResultVo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * 反馈操作接口
 * @author 上玄
 **/
@RestController
@RequestMapping("/api/suggestion")
public class SuggestionController {

    @Resource
    private SuggestionService suggestionService;

    /**
     * 新增
     */
    @PostMapping
    public ResultVo add(@RequestBody Suggestion suggestion) {
        suggestion.setCreateTime(new Date());
        if (suggestionService.save(suggestion)) {
            return ResultVo.success("反馈成功");
        }else {
            return ResultVo.error("反馈失败");
        }
    }

}